package com.example.java8;

/**
 * lambda表达式可以使用的变量
 * @author xiaohf
 * @createTime 2021/7/14 21:05
 **/
public class Java8Test1 {

    final static String salutation = "Hello! ";

    public static void main(String[] args) {
        int num = 1;
        Converter<Integer, String> s = (param) -> {
            int s4 = 3;
            System.out.println(param);
        };

        s.convert(2);  // 输出结果为 3
        GreetingService greetService1 = message -> System.out.println(salutation + message);
        greetService1.sayMessage("Runoob");
    }

    public interface Converter<T1, T2> {
        void convert(int i);
    }
    interface GreetingService {
        void sayMessage(String message);
    }
}
